<template>
    <div class="big-box">
        <div class="header">
            <img src="../../../../../assets/bigScreen/header2.png" alt="" />
            <div class="backBox" @click="goBack"></div>
        </div>
        <div class="backToBox">
            <div class="backTo" @click="gotoHome">
                <div>返回总窗口</div>
            </div>
            <div class="backTo" @click="backToOne">
                <div>返回上一页</div>
            </div>
        </div>
        <div class="centerBox">
            <div class="sreenTitle">众创空间</div>
            <div class="center">
                <div class="top">
                    <div class="infor">
                        <div class="img">
                            <img
                                alt="暂无图片"
                                :src="detail.imgUrl ? detail.imgUrl[0]=='/'? baseURL+detail.imgUrl:detail.imgUrl: '/headerImg/login-bg.png'"
                            />
                        </div>
                        <div class="infor-box">
                            <div class="box">
                                <div class="title">{{detail.name}}</div>
                                <div class="tag">{{detail.makerLevel || "国家级"}}</div>
                            </div>
                            <div class="detail">服务类型：{{detail.type}}</div>
                            <div class="detail">所属领域：{{detail.fieldStr}}</div>
                            <div class="detail">{{detail.type}}类型：{{detail.makerSpaceType}}</div>
                            <div class="detail">孵化面积：{{detail.acreage}}(平方米) </div>
                            <div class="detail">成立时间：{{detail.establishmentTime}} </div>
                            <div class="detail">依托单位：{{detail.supportingUnit}} </div>
                            <!-- <div class="detail">在线平台地址：{{detail.onlineWeb || '无'}} </div> -->
                            <div class="address">地址：{{detail.address||'无'}}</div>
                        </div>
                        <div class="btn">
                            <!-- <div class="btn-item">
                                <img src="../../../assets/incubation/verification1.png" alt="">
                                <div class="text">
                                    孵化 <span class="num">{{detail.itemQuantity}}</span> 个项目
                                </div>
                            </div>
                            <div class="btn-item">
                                <img src="../../../assets/incubation/verification1.png" alt="">
                                <div class="text">
                                举办了 <span class="num">{{detail.activitiesQuantity}}</span> 个活动
                                </div>
                            </div> -->
                        </div>
                    </div>
                </div>
                <div class="content">
                    <div class="combination">
                        <div class="zhu"></div>
                        <div class="title">关于我们</div>
                    </div>
                    <div class="infofText" v-html="detail.introduction"></div>
                    <div class="combination">
                        <div class="zhu"></div>
                        <div class="title">入驻条件</div>
                    </div>
                    <div class="infofText" v-html="detail.entryConditions"></div>
                    <div class="combination">
                        <div class="zhu"></div>
                        <div class="title">入驻流程</div>
                    </div>
                    <div class="infofText" v-html="detail.entryProcess"></div>
                    <div class="combination">
                        <div class="zhu"></div>
                        <div class="title">毕业条件</div>
                    </div>
                    <div class="infofText" v-html="detail.graduationConditions"></div>
                    <div class="combination">
                        <div class="zhu"></div>
                        <div class="title">毕业流程</div>
                    </div>
                    <div class="infofText" v-html="detail.graduationProcess"></div>
                    <div class="combination">
                        <div class="zhu"></div>
                        <div class="title">联系我们</div>
                    </div>
                    <div class="map-container">
                        <div class="map-box">
                            <map-box pos="[116.397428, 39.90923]" :key="mapKey" :markList="[{pos:[detail.longitude,detail.latitude]}]"/>
                        </div>
                        <div class="info-box">
                            <div class="info-box-item">
                                <div class="img">
                                    <img src="../../../../../assets/zaixiandizhi.png" alt="">
                                </div>
                                <div class="text">在线平台地址：{{detail.onlineWeb}}</div>
                            </div>
                            <div class="info-box-item">
                                <div class="img">
                                    <img src="../../../../../assets/incubation/p1.png" alt="">
                                </div>
                                <div class="text">电话：{{detail.mobile}}</div>
                            </div>
                            <div class="info-box-item">
                                <div class="img">
                                    <!-- <img src="../../../assets/incubation/statistics3.png" alt=""> -->
                                    <img src="../../../../../assets/lianxiren.png" alt="">
                                </div>
                                <div class="text">联系人：{{detail.contacts}}</div>
                            </div>
                            <div class="info-box-item">
                                <div class="img">
                                    <img src="../../../../../assets/incubation/p2.png" alt="">
                                </div>
                                <div class="text">邮箱：{{detail.email}}</div>
                            </div>
                            <div class="info-box-item">
                                <div class="img">
                                    <img src="../../../../../assets/incubation/p3.png" alt="">
                                </div>
                                <div class="text">地址：{{detail.city}}{{detail.address}}</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { ref, onMounted, nextTick } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { innovationGetId } from "../../../../../api/incubation"
import mapBox from "../../../../../components/map.vue"
import { getDict } from "../../../../../api/applyEntry.js";
import axios from "axios";
const baseURL = axios.defaults.baseURL;
const router = useRouter()
const pageAct = ref(1)
const dates = ref('')
const route = useRoute()
const mapKey = ref(1)

const detail = ref({})
async function getData() {
    innovationGetId(route.query.id).then((response) => {
        if (response.code == 200) {
            detail.value = response.data
            detail.value.latitude = Number(detail.value.latitude)
            detail.value.longitude = Number(detail.value.longitude)
            mapKey.value++
            detail.value.makerLevel = levelList.value.find(f => f.id == detail.value.makerLevel).label
            detail.value.makerSpaceType = institutionTypeList.value.find(v => v.id == detail.value.makerSpaceType).label
        } else {
        }
    })
}

const levelList = ref([])
const institutionTypeList = ref([])
const getAllDict = async () => {
    //获取级别
    const list = await getDict({
        dictType: "level_type",
        status: 0
    })
    if (list.code == 200) {
        levelList.value = list.data
    }
    const list1 = await getDict({
        dictType: "institution_type",
        status: 0
    })
    if (list1.code == 200) {
        institutionTypeList.value = list1.data
    }
}

//判断时间是否为个位数，如果时间为个位数就在时间之前补上一个“0”
const check = (val) => {
    if (val < 10) {
        return '0' + val
    } else {
        return val
    }
}

const gotoScreen = (act) => {
    router.push({
        path: '/bigScreen',
        query: {
            act: act,
        },
    })
}
const gotoHome = (act) => {
    router.push({
        path: '/bigScreenIndex',
    })
}
const backToOne = (act) => {
    router.go(-1)
}

const goBack = () => {
    router.push('/chart')
}

// gotoHome() {
//             this.$router.push({
//                 path: '/bigScreenIndex',
//             })
//         },
//         backToOne() {
//             console.log('11');
//             this.$router.go(-1)
//         },

const displayTime = () => {
    //获取系统当前的年、月、日、小时、分钟、毫秒
    let date = new Date()
    let year = date.getFullYear()
    let month = date.getMonth() + 1
    let day = date.getDate()
    let hour = date.getHours()
    let minutes = date.getMinutes()
    let seconds = date.getSeconds()
    dates.value = `${year}年${month}月${day}日 ${check(hour)}:${check(minutes)}:${check(seconds)}`
}
//每隔1秒调用一次displayTime函数
const start = () => {
    setInterval(() => {
        displayTime()
    }, 1000) //单位是毫秒
}

nextTick(() => {
    setTimeout(() => {
        let container = document.getElementsByClassName('infofText');
        for (let i = 0; i < container.length; i++) {
            console.log(container[i].innerText);
            container[i].innerHTML = container[i].innerText
        }
    }, 200)
})

onMounted(async () => {
    start()
    // getData()
    await getAllDict()
    getData()
})
</script>

<style scoped lang="scss">
@font-face {
    font-family: "ffa";
    src: url(../../../assets/bigScreen/fonts/DS-DIGIB.TTF);
}
ul,
li {
    list-style: none;
}
.big-box {
    background-color: #071c3b;
    height: 100vh;
}
.header {
    position: relative;
    text-align: center;
    position: relative;
    height: 19.1rem;

    .backBox {
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 70rem;
        height: 10rem;
        cursor: pointer;
    }

    > img {
        width: 100%;
        max-height: 100%;
        margin-top: -1.1rem;
        image-rendering: -moz-crisp-edges; /* Firefox */
        image-rendering: -o-crisp-edges; /* Opera */
        image-rendering: -webkit-optimize-contrast; /* Webkit (non-standard naming) */
        image-rendering: crisp-edges;
        -ms-interpolation-mode: nearest-neighbor; /* IE (non-standard property) */
    }
}
.centerBox {
    width: 96%;
    margin: 0 auto;
    position: absolute;
    top: 14rem;
    left: 2%;
    .sreenTitle {
        background-image: url("../../../../../assets/bigScreen/sreenTitle.png");
        background-size: 100% 100%;
        height: 3.8rem;
        padding-left: 35px;
        font-weight: 600;
        color: #fff;
        display: flex;
        align-items: center;
    }
    .center {
        margin-top: 1rem;
        height: calc(100vh - 20rem);
        border: 1px solid;
        border-image: linear-gradient(
                130deg,
                #2385df 0%,
                rgba(35, 133, 223, 0.65) 92%
            )
            1;
        overflow-y: scroll;
        padding: 20px;
        // background: #fff;
        // background: rgba(255, 255, 255, 0.1);
    }
    ::-webkit-scrollbar {
        width: 5px;
        height: 10px;
    }

    /* 滚动条轨道 */
    ::-webkit-scrollbar-track {
        background-color: #234470;
    }

    /* 滚动条滑块 */
    ::-webkit-scrollbar-thumb {
        background-color: #061c57;
    }

    /* 鼠标悬停在滚动条上的滑块 */
    ::-webkit-scrollbar-thumb:hover {
        background-color: #555;
    }
}
.backToBox {
    position: absolute;
    top: 8rem;
    right: 2%;
    display: flex;
    .backTo {
        background-image: url("../../../../../assets/bigScreen/backTo.png");
        color: #2dccff;
        background-size: 100% 100%;
        width: fit-content;
        padding: 2px 40px 10px 10px;
        font-weight: 600;
        cursor: pointer;
        margin-left: 10px;
        div {
            padding-top: 5px;
        }
    }
}
.top{
    width: 100%;
    height: 46.8rem;
    // background: #F6FAFF;
    display: flex;
}
.zhu{
    width: 0.5rem;
    height: 3rem;
    background: #037AFF;
    margin-right: 2rem;
}
.infor{
    display: flex;
    align-items: center;
    width: 140rem;
    margin: auto;
    .img{
        width: 40.3rem;
        height: 40.3rem;
        background: #ccc;
        img{
            width: 100%;
            height: 100%;
        }
    }
    .infor-box{
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 40.3rem;
        flex:auto;
        margin-left: 3rem;
        .box{
            display: flex;
            align-items: center;
            margin-bottom: 2.5rem;
             .title{
                font-size: 2.6rem;
                font-weight: 700;
                color: #ffffff;
                margin-right: 2rem;
            }

            .tag {
                color: #ffffff;
            }
        }
       
        .detail{
            color: #d4d4d4;
        }
        .address{
            //margin-top: 2.5rem;
            color: #ffffff;
        }
        .thumbnail{
            width: 7.9rem;
            height: 7.9rem;
            background: #ccc;
            box-sizing: border-box;
            border: 1px solid #037AFF;
            img{
                width: 100%;
                height: 100%;
            }
        }
    }
    .btn{
        .btn-item{
            display: flex;
            flex-direction: column;
            justify-content: space-evenly;
            align-items: center;
            width: 20.9rem;
            height: 12.7rem;
            background: #FFFFFF;
            border: 1px solid rgba(234, 234, 234, 0.5);
            text-align: center;
            &:first-child{
                margin-bottom: 2rem;
            }
            img{
                width: 8rem;
                height: 6.8rem;
            }
            .num{
                color: #037AFF;
            }
        }
    }
}
.content{
    width: 140rem;
    margin: auto;
}
.combination{
    display: flex;
    align-items: center;
    border-bottom: 1px solid #1E74C6;
    padding: 2rem 0;
    
    .title{
        font-size: 3.6rem;
        font-weight: 700;
        color: #1F75C7;
    }
}
.infofText{
    font-size: 1.8rem;
    line-height: 3.6rem;
    text-align: justify; /* 浏览器可能不支持 */
    color: #d4d4d4;
    margin: 2rem 0;
    padding: 0 1rem;
}
.map-container {
  display: flex;
//   width: 136rem;
  height: 46rem;
  margin: 4rem auto;
  .map-box {
    flex: 1;
    background: #ffffff;
    padding: 1rem;
  }
  .info-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    height: 100%;
    margin-left: 1.5rem;
    // background: #ffffff;
    padding: 1rem;
    &-item{
        display: flex;
        align-items: center;
        .img{
            width: 4.5rem;
            height: 4.5rem;
            img{
                width: 100%;
                height: 100%;
            }
        }
        .text{
            max-width: 54.6rem;
            font-size: 1.8rem;
            margin-left: 2rem;
            flex: auto;
            padding: 3rem 0;
            border-bottom: 1px solid #1E74C6;
            color: #d4d4d4;
        }
    }
  }
}
</style>
